//
//  FirstVC.m
//  OCMediatorTestA
//
//  Created by dafiger on 2020.04.14.
//  Copyright © 2020 dafiger. All rights reserved.
//

#import "FirstVC.h"

#import <OCMediator/OCMediator.h>

@interface FirstVC ()

@end

@implementation FirstVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor greenColor];
    
    [self performSelector:@selector(jumpB) withObject:nil afterDelay:3.0f];
    // Do any additional setup after loading the view.
}

- (void)jumpB {
    id obj_b = [[OCMediator sharedInstance] openURL:@"Mediator://B/SecondVC"
                                                arg:nil
                                  shouldCacheTarget:YES
                                         completion:^(NSDictionary * _Nullable info)
    {
        NSLog(@"%@", [info objectForKey:@"show"]);
    }];
   
    if (!obj_b) {
        return;
    }
    if ([obj_b isKindOfClass:[UIViewController class]]) {
        NSLog(@"A 准备调用 B");
        UIViewController *secondVC = (UIViewController *)obj_b;
        [self presentViewController:secondVC animated:YES completion:nil];
    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
